clc; clear
ImgSet = 'Set5';
% ImgSet = 'Set14';
scale = 4; % 3;
solver_mode = 'gpu 0';
%%
net = 'Bicubic';
[~, ~, Y, Yhat.Bicubic] = sranaly.analySRQuality(ImgSet, [], scale, net);

%%
% startingNetList = {'VDSR03', 'VDSR18'};
startingNetList = {'SRCNN', 'FSRCNN', 'VDSR0', 'RED', 'DRRN'};
% startingNetList = {'VDSR03', 'VDSR19', 'VDSR35'};

for i = 1 : length(startingNetList)
    net = startingNetList{i};
    [~, ~, ~, Yhat.(net)] = sranaly.analySRQuality(ImgSet, [], scale, net, [], solver_mode);
end

%%
% imshows(cat(3, Yhat.Bicubic{1}, Yhat.SRCNN{1}, Y{1}, r, r1), 2)

%%
k = 5;
% close all
nets = fieldnames(Yhat);
for i = 1 : length(nets)
    net = nets{i};
    [~, ~, ~, R.(net)] = sranaly.analySRQuality(Yhat.(net){k}, Y{k}, scale, net, [], []);
    % [~, ~, ~, R.(net)] = sranaly.analySRQuality(Yhat.Bicubic{k}, Yhat.(net){k}, scale, net, [], []);
    while iscell(R.(net)), R.(net) = R.(net){1}; end
end

%%
% close all
imshows(abs([R.Bicubic, R.SRCNN, R.FSRCNN; R.VDSR0, R.RED, R.DRRN]))

% imshows(abs([R.Bicubic, R.VDSR18]))
% imshows(abs([R.Bicubic, R.SRCNN, R.FSRCNN; R.RED, R.VDSR0, R.DRRN]))
% colormap jet

%%
% imshows(cat(3, abs(r), abs(r1)), 1)

%%
% close all
% figure;
% subplot(211); hist(abs(r(:)), 60);
% subplot(212); hist(abs(r1(:)), 60);
